<?php

namespace app\index\job;

use think\queue\Job;

class DelayTask
{
    public function fire(Job $job, $data)
    {
        // 执行任务逻辑
        echo "处理延时任务，数据：" . json_encode($data);

        file_put_contents(RUNTIME_PATH . 'log.txt', json_encode($data) . PHP_EOL, FILE_APPEND);

        // 任务执行成功后删除
        $job->delete();
    }
}
